package com.example.work_one

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.*
import androidx.appcompat.app.AlertDialog

class MainActivity : AppCompatActivity() ,FinishActivity{

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        create(this)
        val button:Button=findViewById(R.id.button1)
        var set=0
        button.setOnClickListener {
            set++
            val editText:EditText=findViewById(R.id.userId)
            val inputText="Welcome"+editText.text.toString()
            Toast.makeText(this,inputText,Toast.LENGTH_SHORT).show()
            val imageView:ImageView=findViewById(R.id.image_market)
            val progressBar:ProgressBar=findViewById(R.id.progressBar)
            imageView.setImageResource(R.drawable.welcome_pic)
            progressBar.progress+=50
            if(set==2){
                val intent=Intent(this,ShopActivity::class.java)
                startActivity(intent)
            }
            AlertDialog.Builder(this).apply {
                setTitle("Confirm login?")
                setMessage("Welcome to your arrival")
                setCancelable(false)
                setPositiveButton("Yes"){dialog,which->}
                setNegativeButton("No"){dialog,which->}
                show()
            }

        }
    }
}